(set *failed* (set *passed* 0))

(define test-is
	X -> (if (= X true)
				(do (set *passed* (+ (value *passed*) 1)) 
				    passed)
				(do (set *failed* (+ (value *failed*) 1)) 
				    failed)))

"Lists"
(test-is (= (trap-error (hd 5) (/. E -1)) -1))
(test-is (= (trap-error (tl 5) (/. E -1)) -1))
(test-is (= (hd [1 2 3]) 1))
(test-is (= (tl [1 2 3]) [2 3]))
(test-is (= (cons 5 10) [5 10]))
					
"Strings"			
(test-is (= (str hello) "hello"))
(test-is (= (str 5) "5"))
(test-is (= (str "hello") (cn "\"" (cn "hello" "\""))))
(test-is (string? (str 5)))
(test-is (string? (str hello)))
(test-is (string? (str "hello")))

(test-is (= "helloWorld" (cn "hello" "World")))
(test-is (= "hello" (cn "hello" "")))
(test-is (= "hello" (cn "" "hello")))

(map (/. X (test-is (= (pos "hello" X) (pos (tlstr "hello") (- X 1))))) [1 2 3 4])

"Tuples"
(test-is (tuple? (@p hello ())))
(test-is (= (fst (@p hello ())) hello))
(test-is (= (snd (@p hello ())) ()))

"Symbols"
(test-is (symbol? x))
(test-is (= x (intern "x")))
(test-is (= (intern (cn "x" "y")) (concat x y)))

"Vectors"
(set x (vector 100))
(test-is (= (<-address (value x) 0) 100))
(test-is (= (<-address (value x) 1) (fail)))
(test-is (= (<-address (value x) 99) (fail)))
(test-is (= (trap-error (<-address (value x) 101) (/. E -1)) -1))
(address-> (value x) 10 100)
(test-is (= (<-address (value x) 10) 100))

"Absvectors"
(set x (absvector 100))
(test-is (= (<-address (value x) 1) (fail)))
(test-is (= (<-address (value x) 99) (fail)))
(test-is (= (trap-error (<-address (value x) 100) (/. E -1)) -1))
(address-> (value x) 10 100)
(test-is (= (<-address (value x) 10) 100))

"Exceptions"
(test-is (= (trap-error (/ 1 0) (/. E -1)) -1))
(test-is (= (trap-error (/ 1 0) (/. E (error-to-string E))) "division by zero"))

"Numbers"
(test-is (= 10e2 1000))
(test-is (= 1 1.0))
(test-is (= --3 3))
(test-is (= ---5 -5.0))

(intoutput "~%passed ... ~A~%failed ... ~A~%Passrate ... ~A %~%" (@p (value *passed*) (@p (value *failed*) (@p (/ (* 100 (value *passed*)) (+ (value *failed*) (value *passed*))) ()))))